package cn.com.se.sharepictrue.adapter;

import android.content.Context;

import java.util.Collection;
import java.util.List;

import cn.com.se.sharepictrue.R;
import cn.com.se.sharepictrue.bean.Comment;
import cn.com.se.sharepictrue.business.ImageLoader;
import cn.com.se.sharepictrue.utils.StringUtils;

/**
 * Created by KIDNG on 2015/12/7.
 */
public class CommentAdapter extends BaseRecyclerAdapter<Comment> {
    public CommentAdapter(Context context) {
        super(context);
    }

    public CommentAdapter(Context context, List<Comment> data) {
        super(context, data);
    }

    public CommentAdapter(Context context, Collection<? extends Comment> collection) {
        super(context, collection);
    }

    @Override
    public void onBindViewHolder(RecyclerHolder holder, Comment data) {
        if(!StringUtils.isEmpty(data.getAvatar())){
            ImageLoader.getInstance(getContext()).load(holder.getImageView(R.id.civ_comment_avatar),data.getAvatar(),R.mipmap.bg_drawer);
        }
        holder.getTextView(R.id.tv_comment_name).setText(data.getUserName());
        holder.getTextView(R.id.tv_comment_content).setText(data.getComment());
        holder.getTextView(R.id.tv_comment_signature).setText(data.getSignature());
    }

    @Override
    public int getLayoutRes(int viewType) {
        return R.layout.item_comment;
    }
}
